FROM composer:2.8.2 AS composer
FROM php:8.0.30-fpm

# 时区设置
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo Asia/Shanghai > /etc/timezone


# 拷贝composer
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

# 安装redis扩展
# RUN pecl install "https://pecl.php.net/get/redis-5.3.7.tgz"

RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list \
    && sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list \
    && apt-get update -y \
    && apt-get install telnet net-tools libzip-dev zip libonig-dev libbz2-dev libfreetype6-dev libwebp-dev libpng-dev libjpeg-dev libxslt-dev libxml2-dev curl libcurl3-dev openssl libssl-dev libevent-dev -y \
    && docker-php-ext-install bcmath mbstring pdo pdo_mysql zip bz2 calendar bcmath curl pcntl sockets opcache \
    && docker-php-ext-configure gd --with-webp=/usr/include --with-jpeg=/usr/include --with-freetype=/usr/include && docker-php-ext-install gd

RUN docker-php-ext-enable opcache \
    && pecl install event && docker-php-ext-enable --ini-name zz-event.ini event \
    && pecl install redis && docker-php-ext-enable redis

# RUN apt-get install ffmpeg python3 -y

# 工作目录
ENV WORK_DIR='/data/project'
WORKDIR $WORK_DIR

# CMD [ "php", "./public/server.php" ]